package com.service.impl;

import com.dao.RbacPermDao;
import com.entity.RbacPerm;
import com.entity.ResponseEntity;
import com.service.RbacPermService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;
@Service
public class RbacPermServiceImpl implements RbacPermService {
    @Autowired
    RbacPermDao rbacPermDao;

    @Autowired
    RedisTemplate redisTemplate;

    @Override
    public Set<String> findByAccount(String account) {
        Set<String> set = rbacPermDao.findByAccount(account);
        redisTemplate.opsForHash().put("rbacPerm",account,set);
        return set;
    }

    @Override
    public ResponseEntity findAll() {
        List<RbacPerm> list =  rbacPermDao.findAll();
        return new ResponseEntity(200,"成功找到",list);
    }
}
